/*
* CSET 3600
* Spring Semester 2013
* Melissa Brown
* Josh Siebenaler
* Matt Rich
* Christian Angelo
*
*/
package mancala;


public class MancalaGameBoardGUI extends javax.swing.JFrame  {
    
    public static int SetHoleValue;
    private static int [] ReturnHoleValue = new int [16];
    public static String [] InitialValues = new String [16];
    private static String [] ConvertValueToText = new String [16];
    private static String [] BoardValues = new String [16];
    //public static boolean Status;
    //public static boolean ResetStatus = false;
    //public static int [] EndingValues;
    public static String StatusGame;
   // public  boolean Delete2;
    //public static boolean DeleteOldGames = false;
    //public static int [] WLScores;
    public static String Versus;
    public static boolean computer;
    //public static int ComputerValue;
    public static String Diff;
    public static int nexthole = 0;
   
    
    
    
    
    
    
    
    /** Creates new form MancalaGameBoardGUI */
    public MancalaGameBoardGUI() {
        
        SetHoleValue = -1;
        ReturnHoleValue = HolePlacementAlgorithm.ReturnHoleValue(SetHoleValue, ReturnHoleValue);
        initComponents();
        
       
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        player1pit = new javax.swing.JButton();
        player2pit = new javax.swing.JButton();
        player2hole7 = new javax.swing.JButton();
        player1hole1 = new javax.swing.JButton();
        player1hole2 = new javax.swing.JButton();
        player2hole6 = new javax.swing.JButton();
        player2hole5 = new javax.swing.JButton();
        player1hole3 = new javax.swing.JButton();
        player2hole4 = new javax.swing.JButton();
        player1hole4 = new javax.swing.JButton();
        player2hole3 = new javax.swing.JButton();
        player1hole5 = new javax.swing.JButton();
        player2hole2 = new javax.swing.JButton();
        player1hole6 = new javax.swing.JButton();
        player2hole1 = new javax.swing.JButton();
        player1hole7 = new javax.swing.JButton();
        gameboardexit = new javax.swing.JButton();
        gameboardrestart = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        boardtitle = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Mancala Game");
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        setName("MancalaBoard"); // NOI18N
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
            public void windowActivated(java.awt.event.WindowEvent evt) {
                formWindowActivated(evt);
            }
            public void windowDeactivated(java.awt.event.WindowEvent evt) {
                formWindowDeactivated(evt);
            }
        });
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        player1pit.setBackground(new java.awt.Color(238, 233, 216));
        player1pit.setFont(new java.awt.Font("Times New Roman", 1, 12));
        player1pit.setText("0");
        player1pit.setEnabled(false);
        player1pit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                player1pitActionPerformed(evt);
            }
        });
        getContentPane().add(player1pit, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 55, 246, 52));

        player2pit.setFont(new java.awt.Font("Times New Roman", 1, 12));
        player2pit.setText("0");
        player2pit.setEnabled(false);
        getContentPane().add(player2pit, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 470, 246, 51));

        player2hole7.setFont(new java.awt.Font("Times New Roman", 0, 12));
        player2hole7.setText("7");
        player2hole7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                player2hole7ActionPerformed(evt);
            }
        });
        getContentPane().add(player2hole7, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 113, 114, 45));

        player1hole1.setFont(new java.awt.Font("Times New Roman", 0, 12));
        player1hole1.setText("7");
        player1hole1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                player1hole1ActionPerformed(evt);
            }
        });
        getContentPane().add(player1hole1, new org.netbeans.lib.awtextra.AbsoluteConstraints(138, 113, 114, 45));

        player1hole2.setFont(new java.awt.Font("Times New Roman", 0, 12));
        player1hole2.setText("7");
        player1hole2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                player1hole2ActionPerformed(evt);
            }
        });
        getContentPane().add(player1hole2, new org.netbeans.lib.awtextra.AbsoluteConstraints(138, 164, 114, 45));

        player2hole6.setFont(new java.awt.Font("Times New Roman", 0, 12));
        player2hole6.setText("7");
        player2hole6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                player2hole6ActionPerformed(evt);
            }
        });
        getContentPane().add(player2hole6, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 164, 114, 45));

        player2hole5.setFont(new java.awt.Font("Times New Roman", 0, 12));
        player2hole5.setText("7");
        player2hole5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                player2hole5ActionPerformed(evt);
            }
        });
        getContentPane().add(player2hole5, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 215, 114, 45));

        player1hole3.setFont(new java.awt.Font("Times New Roman", 0, 12));
        player1hole3.setText("7");
        player1hole3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                player1hole3ActionPerformed(evt);
            }
        });
        getContentPane().add(player1hole3, new org.netbeans.lib.awtextra.AbsoluteConstraints(138, 215, 114, 45));

        player2hole4.setFont(new java.awt.Font("Times New Roman", 0, 12));
        player2hole4.setText("7");
        player2hole4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                player2hole4ActionPerformed(evt);
            }
        });
        getContentPane().add(player2hole4, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 266, 114, 45));

        player1hole4.setFont(new java.awt.Font("Times New Roman", 0, 12));
        player1hole4.setText("7");
        player1hole4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                player1hole4ActionPerformed(evt);
            }
        });
        getContentPane().add(player1hole4, new org.netbeans.lib.awtextra.AbsoluteConstraints(138, 266, 114, 45));

        player2hole3.setFont(new java.awt.Font("Times New Roman", 0, 12));
        player2hole3.setText("7");
        player2hole3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                player2hole3ActionPerformed(evt);
            }
        });
        getContentPane().add(player2hole3, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 317, 114, 45));

        player1hole5.setFont(new java.awt.Font("Times New Roman", 0, 12));
        player1hole5.setText("7");
        player1hole5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                player1hole5ActionPerformed(evt);
            }
        });
        getContentPane().add(player1hole5, new org.netbeans.lib.awtextra.AbsoluteConstraints(138, 317, 114, 45));

        player2hole2.setFont(new java.awt.Font("Times New Roman", 0, 12));
        player2hole2.setText("7");
        player2hole2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                player2hole2ActionPerformed(evt);
            }
        });
        getContentPane().add(player2hole2, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 368, 114, 45));

        player1hole6.setFont(new java.awt.Font("Times New Roman", 0, 12));
        player1hole6.setText("7");
        player1hole6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                player1hole6ActionPerformed(evt);
            }
        });
        getContentPane().add(player1hole6, new org.netbeans.lib.awtextra.AbsoluteConstraints(138, 368, 114, 45));

        player2hole1.setFont(new java.awt.Font("Times New Roman", 0, 12));
        player2hole1.setText("7");
        player2hole1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                player2hole1ActionPerformed(evt);
            }
        });
        getContentPane().add(player2hole1, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 419, 114, 45));

        player1hole7.setFont(new java.awt.Font("Times New Roman", 0, 12));
        player1hole7.setText("7");
        player1hole7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                player1hole7ActionPerformed(evt);
            }
        });
        getContentPane().add(player1hole7, new org.netbeans.lib.awtextra.AbsoluteConstraints(138, 419, 114, 45));

        gameboardexit.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N
        gameboardexit.setText("Exit");
        gameboardexit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                gameboardexitActionPerformed(evt);
            }
        });
        getContentPane().add(gameboardexit, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 530, -1, -1));

        gameboardrestart.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N
        gameboardrestart.setText("Restart");
        gameboardrestart.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                gameboardrestartActionPerformed(evt);
            }
        });
        getContentPane().add(gameboardrestart, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 530, -1, -1));

        jButton1.setText("Home Screen");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 530, -1, -1));

        boardtitle.setFont(new java.awt.Font("Times New Roman", 1, 36));
        boardtitle.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        boardtitle.setText("Mancala");
        getContentPane().add(boardtitle, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, 225, -1));

        jLabel2.setBackground(new java.awt.Color(102, 51, 0));
        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mancala/mhAV6x6.jpg"))); // NOI18N
        getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 260, 560));

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void gameboardexitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_gameboardexitActionPerformed
        System.exit(0);
    }//GEN-LAST:event_gameboardexitActionPerformed

    private void player1hole3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_player1hole3ActionPerformed
        SetHoleValue = 3;
         
        
        BoardValues = ConvertNumberToTextForDisplayOnScreen(ConvertValueToText,
                                                 ReturnHoleValue,SetHoleValue);
        UpdateBoardWithNewValues(BoardValues);
         Versus = "Player 2";
         WhoPlaying(Versus);//this works(need to set player 2 = true though when 
//versus = player 1(under player 1 settings...player 1 = false, 2 = true) and then
         //copy in each button aciton(keep window opened though)
    }//GEN-LAST:event_player1hole3ActionPerformed

    private void player2hole7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_player2hole7ActionPerformed
        SetHoleValue = 15;
        BoardValues = ConvertNumberToTextForDisplayOnScreen(ConvertValueToText,
                                                 ReturnHoleValue,SetHoleValue);
        UpdateBoardWithNewValues(BoardValues); 
        Versus = "Player 1";
        WhoPlaying(Versus);
    }//GEN-LAST:event_player2hole7ActionPerformed

    private void player1hole7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_player1hole7ActionPerformed
         SetHoleValue = 7;
         BoardValues = ConvertNumberToTextForDisplayOnScreen(ConvertValueToText,
                                                 ReturnHoleValue,SetHoleValue);
         UpdateBoardWithNewValues(BoardValues);
          Versus = "Player 2";
          WhoPlaying(Versus);
    }//GEN-LAST:event_player1hole7ActionPerformed

    private void player2hole6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_player2hole6ActionPerformed

         SetHoleValue = 14;
         BoardValues = ConvertNumberToTextForDisplayOnScreen(ConvertValueToText,
                                                 ReturnHoleValue,SetHoleValue);
        UpdateBoardWithNewValues(BoardValues);
        Versus = "Player 1";
        WhoPlaying(Versus);
        
    }//GEN-LAST:event_player2hole6ActionPerformed

    private void player2hole5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_player2hole5ActionPerformed

        SetHoleValue = 13;
        BoardValues = ConvertNumberToTextForDisplayOnScreen(ConvertValueToText,
                                                 ReturnHoleValue,SetHoleValue);
        UpdateBoardWithNewValues(BoardValues);
         Versus = "Player 1";
         WhoPlaying(Versus);
    }//GEN-LAST:event_player2hole5ActionPerformed

    private void player2hole4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_player2hole4ActionPerformed
        SetHoleValue = 12;
        BoardValues = ConvertNumberToTextForDisplayOnScreen(ConvertValueToText,
                                                 ReturnHoleValue,SetHoleValue);
        UpdateBoardWithNewValues(BoardValues);  
        Versus = "Player 1";
        WhoPlaying(Versus);
        
        // TODO add your handling code here:
    }//GEN-LAST:event_player2hole4ActionPerformed

    private void gameboardrestartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_gameboardrestartActionPerformed
        // TODO add your handling code here:
        //new ResetScreen().setVisible(true);
        
        setVisible(false);
        new MancalaGameBoardGUI().setVisible(true);
  
    }//GEN-LAST:event_gameboardrestartActionPerformed

    private void player1hole1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_player1hole1ActionPerformed
        SetHoleValue = 1;
        BoardValues = ConvertNumberToTextForDisplayOnScreen(ConvertValueToText,
                                                 ReturnHoleValue,SetHoleValue);
        UpdateBoardWithNewValues(BoardValues);
         Versus = "Player 2";
         WhoPlaying(Versus);
        
        // TODO add your handling code here:
    }//GEN-LAST:event_player1hole1ActionPerformed

    private void player1hole2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_player1hole2ActionPerformed
       SetHoleValue = 2;
        BoardValues = ConvertNumberToTextForDisplayOnScreen(ConvertValueToText,
                                                 ReturnHoleValue,SetHoleValue);
        UpdateBoardWithNewValues(BoardValues);
         Versus = "Player 2";
         WhoPlaying(Versus);
        
        // TODO add your handling code here:
    }//GEN-LAST:event_player1hole2ActionPerformed

    private void player1hole4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_player1hole4ActionPerformed
        SetHoleValue = 4;
        BoardValues = ConvertNumberToTextForDisplayOnScreen(ConvertValueToText,
                                                 ReturnHoleValue,SetHoleValue);
        UpdateBoardWithNewValues(BoardValues);
         Versus = "Player 2";
         WhoPlaying(Versus);
        
        // TODO add your handling code here:
    }//GEN-LAST:event_player1hole4ActionPerformed

    private void player1hole5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_player1hole5ActionPerformed
      SetHoleValue = 5;
        BoardValues = ConvertNumberToTextForDisplayOnScreen(ConvertValueToText,
                                                 ReturnHoleValue,SetHoleValue);
        UpdateBoardWithNewValues(BoardValues);
         Versus = "Player 2";
         WhoPlaying(Versus);
        
        // TODO add your handling code here:
    }//GEN-LAST:event_player1hole5ActionPerformed

    private void player1hole6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_player1hole6ActionPerformed
       SetHoleValue = 6;
        BoardValues = ConvertNumberToTextForDisplayOnScreen(ConvertValueToText,
                                                 ReturnHoleValue,SetHoleValue);
        UpdateBoardWithNewValues(BoardValues);
        Versus = "Player 2";
        WhoPlaying(Versus);
        
        // TODO add your handling code here:
    }//GEN-LAST:event_player1hole6ActionPerformed

    private void player2hole1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_player2hole1ActionPerformed
        SetHoleValue = 9;
        BoardValues = ConvertNumberToTextForDisplayOnScreen(ConvertValueToText,
                                                 ReturnHoleValue,SetHoleValue);
        UpdateBoardWithNewValues(BoardValues);
        Versus = "Player 1";
        WhoPlaying(Versus);
       // WhoPlaying(Versus);
        
        // TODO add your handling code here:
    }//GEN-LAST:event_player2hole1ActionPerformed

    private void player2hole2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_player2hole2ActionPerformed
        SetHoleValue = 10;
        BoardValues = ConvertNumberToTextForDisplayOnScreen(ConvertValueToText,
                                                 ReturnHoleValue,SetHoleValue);
        UpdateBoardWithNewValues(BoardValues);
        Versus = "Player 1";
        WhoPlaying(Versus);
        
        // TODO add your handling code here:
    }//GEN-LAST:event_player2hole2ActionPerformed

    private void player2hole3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_player2hole3ActionPerformed
        SetHoleValue = 11;
        BoardValues = ConvertNumberToTextForDisplayOnScreen(ConvertValueToText,
                                                 ReturnHoleValue,SetHoleValue);
        UpdateBoardWithNewValues(BoardValues);
        Versus = "Player 1";
        WhoPlaying(Versus);
        
        // TODO add your handling code here:
    }//GEN-LAST:event_player2hole3ActionPerformed

    private void formWindowDeactivated(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowDeactivated
        // TODO add your handling code here:
        
        setVisible(false);
    }//GEN-LAST:event_formWindowDeactivated

    private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
        // TODO add your handling code here:
        
        WhoPlaying(Versus);
        System.out.println(Versus);
    }//GEN-LAST:event_formWindowOpened

    private void formWindowActivated(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowActivated
        // TODO add your handling code here:
    }//GEN-LAST:event_formWindowActivated

    private void player1pitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_player1pitActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_player1pitActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        
        new HomeScreenGUI().setVisible(true);
        setVisible(false);
        
        // TODO add your handling code here:
        
        
    }//GEN-LAST:event_jButton1ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        
        
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                
                  SetHoleValue = -1;
                  ReturnHoleValue = HolePlacementAlgorithm.ReturnHoleValue(SetHoleValue, ReturnHoleValue);
                
         
            }
        });
    }
    
    /**
     *
     * @param ConvertValueToText
     * @param ReturnHoleValue
     * @return
     */
     public static String[] ConvertNumberToTextForDisplayOnScreen(String[] 
         ConvertValueToText, int [] ReturnHoleValue, int SetHoleValue){
         
         System.out.println("currenthole v2 is" + SetHoleValue);
         
            ReturnHoleValue = HolePlacementAlgorithm.ReturnHoleValue(SetHoleValue,ReturnHoleValue);
        
            for( int i = 0; i < ReturnHoleValue.length; i ++){
                
                ConvertValueToText[i] = Integer.toString(ReturnHoleValue[i]);
            }
       
        return ConvertValueToText;
      }
     
     public  String [] UpdateBoardWithNewValues(String[] BoardValues){
         
         player1pit.setText(BoardValues[0]);
         player1hole1.setText(BoardValues[1]);
         player1hole2.setText(BoardValues[2]);
         player1hole3.setText(BoardValues[3]);
         player1hole4.setText(BoardValues[4]);
         player1hole5.setText(BoardValues[5]);
         player1hole6.setText(BoardValues[6]);
         player1hole7.setText(BoardValues[7]);
         player2pit.setText(BoardValues[8]);
         player2hole1.setText(BoardValues[9]);
         player2hole2.setText(BoardValues[10]);
         player2hole3.setText(BoardValues[11]);
         player2hole4.setText(BoardValues[12]);
         player2hole5.setText(BoardValues[13]);
         player2hole6.setText(BoardValues[14]);
         player2hole7.setText(BoardValues[15]);
       
         
         
        return null;
         
     }
    
    
               
     
     public static void DisplayEndScreen(boolean Status){//this needs to be method in
         //end game screen...all it does is handle zero stones in left or right 
         //or neither
         
         int leftovers;
         
         if (Status = true){
             if(StatusGame == "left"){
                 leftovers = 96 - ReturnHoleValue[0] - ReturnHoleValue[8];
                 
                 ReturnHoleValue[8] += leftovers;
                 System.out.println(ReturnHoleValue[8]);
                    EndGameScreen.WLScores[0] = (ReturnHoleValue[0]);
             EndGameScreen.WLScores[1] = ReturnHoleValue[8] ;
             //new EndGameScreen().setVisible(true);
                 
          }else if(StatusGame == "right"){
              
               leftovers = 96 - ReturnHoleValue[0] - ReturnHoleValue[8];
               ReturnHoleValue[0] += leftovers;
                    EndGameScreen.WLScores[0] = (ReturnHoleValue[0]);
             EndGameScreen.WLScores[1] = (ReturnHoleValue[8] );
           //  new EndGameScreen().setVisible(true);
              
          }else{
             EndGameScreen.WLScores[0] = (ReturnHoleValue[0]);
             EndGameScreen.WLScores[1] = (ReturnHoleValue[8]);
           // new EndGameScreen().setVisible(true);//check why these won't display
             }
       new EndGameScreen().setVisible(true);

         }
             
     }
     
    
     public  boolean WhoPlaying(String Versus){
         
         
         
         if ( Versus == "Player 1"){
             
             //System.out.println("You have selected player 2");
             
             player2hole1.setEnabled(false);
             player2hole2.setEnabled(false);
             player2hole3.setEnabled(false);
             player2hole4.setEnabled(false);
             player2hole5.setEnabled(false);
             player2hole6.setEnabled(false);
             player2hole7.setEnabled(false);
             player1hole1.setEnabled(true);
              player1hole2.setEnabled(true);
             player1hole3.setEnabled(true);
             player1hole4.setEnabled(true);
             player1hole5.setEnabled(true);
             player1hole6.setEnabled(true);
             player1hole7.setEnabled(true);
             
            //System.out.println("last com value" + computer);
             
               if(computer == true){
                 
                // System.out.println("you selected computer");
                 
                // System.out.println(ComputerValue);
                 
               Difficult(Diff);
               
                 Versus = "Computer";
                 WhoPlaying(Versus);
             }
             
         }
         else if (Versus == "Player 2" || Versus == "Computer"){
             
             player1hole1.setEnabled(false);
             player1hole2.setEnabled(false);
             player1hole3.setEnabled(false);
             player1hole4.setEnabled(false);
             player1hole5.setEnabled(false);
             player1hole6.setEnabled(false);
             player1hole7.setEnabled(false);
              player2hole1.setEnabled(true);
             player2hole2.setEnabled(true);
             player2hole3.setEnabled(true);
             player2hole4.setEnabled(true);
             player2hole5.setEnabled(true);
             player2hole6.setEnabled(true);
             player2hole7.setEnabled(true);
             
             
             
         }
         else{
             
             //  System.out.println("you selected computer");
                 
               //  System.out.println(ComputerValue);
                 
               Difficult(Diff);
               
                 Versus = "Computer";
                 WhoPlaying(Versus);
             
         }
         
         
         
        return false;
         
         
     }
     
     
         public  String  Difficult(String Diff){
             
             
          
             int Hole = 0;
             
             if(Diff == "Easy"){
                 
                 Hole = EasyAI.ChooseHole(ReturnHoleValue,nexthole);
                 nexthole = Hole;//need to change to easy ai
                // System.out.println("computer hole value is" + Hole);
                 
             } else if (Diff == "Hard"){
                 
               Hole = HardAI.Options(ReturnHoleValue);
                 
                 
             }
             
             BoardValues = ConvertNumberToTextForDisplayOnScreen(ConvertValueToText,
                                                 ReturnHoleValue,Hole);
              UpdateBoardWithNewValues(BoardValues);
            
             
             return null;
         }
     
     
     
     
         
       
     

     
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel boardtitle;
    private javax.swing.JButton gameboardexit;
    private javax.swing.JButton gameboardrestart;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JButton player1hole1;
    private javax.swing.JButton player1hole2;
    private javax.swing.JButton player1hole3;
    private javax.swing.JButton player1hole4;
    private javax.swing.JButton player1hole5;
    private javax.swing.JButton player1hole6;
    private javax.swing.JButton player1hole7;
    private javax.swing.JButton player1pit;
    private javax.swing.JButton player2hole1;
    private javax.swing.JButton player2hole2;
    private javax.swing.JButton player2hole3;
    private javax.swing.JButton player2hole4;
    private javax.swing.JButton player2hole5;
    private javax.swing.JButton player2hole6;
    private javax.swing.JButton player2hole7;
    private javax.swing.JButton player2pit;
    // End of variables declaration//GEN-END:variables
}


